package com.huawei.hwclouds.lubanops.demo.common.client;

import com.huawei.hwclouds.lubanops.demo.common.client.impl.ApacheHttpClientCommon;
import com.huawei.hwclouds.lubanops.demo.common.client.impl.ApacheHttpClientSSL;

/**
 * 产生httpclient的工厂，封装了默认的实现
 * 方便未来实现类的更改
 *
 * @author y00438022
 * @since 2020/11/8
 **/
public class HttpClientFactory {

    public static HttpClient getHttpClientCommon(int maxTotal, int maxIdleTimeInSeconds, int defaultTimeout) {
        return new ApacheHttpClientCommon(maxTotal, maxIdleTimeInSeconds, defaultTimeout);
    }

    public static HttpClient getHttpClientCommon(int maxTotal, int maxIdleTimeInSeconds, int defaultTimeout,
        HeaderFactory headerFactory) {
        return new ApacheHttpClientCommon(maxTotal, maxIdleTimeInSeconds, defaultTimeout, headerFactory);
    }

    public static HttpClient getHttpClientSSL(String configContext, int maxTotal, int maxIdleTimeInSeconds,
        int defaultTimeout) {
        return new ApacheHttpClientSSL(configContext, maxTotal, maxIdleTimeInSeconds, defaultTimeout);
    }

    public static HttpClient getHttpClientSSL(String configContext, int maxTotal, int maxIdleTimeInSeconds,
        int defaultTimeout, HeaderFactory headerFactory) {
        return new ApacheHttpClientSSL(configContext, maxTotal, maxIdleTimeInSeconds, defaultTimeout, headerFactory);
    }

}
